<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>BSON type classes and serialization functions</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongodb-driver-writeresult.isacknowledged.html">« MongoDB\Driver\WriteResult::isAcknowledged</a></li>
      <li style="float: right;"><a href="ref.bson.functions.html">函数 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="set.mongodb.html">MongoDB</a></li>
    <li>BSON type classes and serialization functions</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="book.bson" class="book">
  <h1 class="title">BSON type classes and serialization functions</h1>
  

  

  
 





  
 





  
 





  
 





  
 





  
 





  
 





  
 





  
 






  
 





  
 





  






  







  






  






  






  
 





  
 





  






  






  






  







  
 





  
 





  
 





  
 





 <ul class="chunklist chunklist_book"><li><a href="ref.bson.functions.html">函数</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.mongodb.bson-fromjson.html">MongoDB\BSON\fromJSON</a> — Returns the BSON representation of a JSON value</li><li><a href="function.mongodb.bson-fromphp.html">MongoDB\BSON\fromPHP</a> — Returns the BSON representation of a PHP value</li><li><a href="function.mongodb.bson-tocanonicalextendedjson.html">MongoDB\BSON\toCanonicalExtendedJSON</a> — Returns the Canonical Extended JSON representation of a BSON value</li><li><a href="function.mongodb.bson-tojson.html">MongoDB\BSON\toJSON</a> — Returns the Legacy Extended JSON representation of a BSON value</li><li><a href="function.mongodb.bson-tophp.html">MongoDB\BSON\toPHP</a> — Returns the PHP representation of a BSON value</li><li><a href="function.mongodb.bson-torelaxedextendedjson.html">MongoDB\BSON\toRelaxedExtendedJSON</a> — Returns the Relaxed Extended JSON representation of a BSON value</li></ul></li><li><a href="class.mongodb-bson-binary.html">MongoDB\BSON\Binary</a> — The MongoDB\BSON\Binary class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-binary.construct.html">MongoDB\BSON\Binary::__construct</a> — Construct a new Binary</li><li><a href="mongodb-bson-binary.getdata.html">MongoDB\BSON\Binary::getData</a> — Returns the Binary's data</li><li><a href="mongodb-bson-binary.gettype.html">MongoDB\BSON\Binary::getType</a> — Returns the Binary's type</li><li><a href="mongodb-bson-binary.jsonserialize.html">MongoDB\BSON\Binary::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-binary.serialize.html">MongoDB\BSON\Binary::serialize</a> — Serialize a Binary</li><li><a href="mongodb-bson-binary.tostring.html">MongoDB\BSON\Binary::__toString</a> — Returns the Binary's data</li><li><a href="mongodb-bson-binary.unserialize.html">MongoDB\BSON\Binary::unserialize</a> — Unserialize a Binary</li></ul></li><li><a href="class.mongodb-bson-decimal128.html">MongoDB\BSON\Decimal128</a> — The MongoDB\BSON\Decimal128 class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-decimal128.construct.html">MongoDB\BSON\Decimal128::__construct</a> — Construct a new Decimal128</li><li><a href="mongodb-bson-decimal128.jsonserialize.html">MongoDB\BSON\Decimal128::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-decimal128.serialize.html">MongoDB\BSON\Decimal128::serialize</a> — Serialize a Decimal128</li><li><a href="mongodb-bson-decimal128.tostring.html">MongoDB\BSON\Decimal128::__toString</a> — Returns the string representation of this Decimal128</li><li><a href="mongodb-bson-decimal128.unserialize.html">MongoDB\BSON\Decimal128::unserialize</a> — Unserialize a Decimal128</li></ul></li><li><a href="class.mongodb-bson-javascript.html">MongoDB\BSON\Javascript</a> — The MongoDB\BSON\Javascript class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-javascript.construct.html">MongoDB\BSON\Javascript::__construct</a> — Construct a new Javascript</li><li><a href="mongodb-bson-javascript.getcode.html">MongoDB\BSON\Javascript::getCode</a> — Returns the Javascript's code</li><li><a href="mongodb-bson-javascript.getscope.html">MongoDB\BSON\Javascript::getScope</a> — Returns the Javascript's scope document</li><li><a href="mongodb-bson-javascript.jsonserialize.html">MongoDB\BSON\Javascript::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-javascript.serialize.html">MongoDB\BSON\Javascript::serialize</a> — Serialize a Javascript</li><li><a href="mongodb-bson-javascript.tostring.html">MongoDB\BSON\Javascript::__toString</a> — Returns the Javascript's code</li><li><a href="mongodb-bson-javascript.unserialize.html">MongoDB\BSON\Javascript::unserialize</a> — Unserialize a Javascript</li></ul></li><li><a href="class.mongodb-bson-maxkey.html">MongoDB\BSON\MaxKey</a> — The MongoDB\BSON\MaxKey class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-maxkey.construct.html">MongoDB\BSON\MaxKey::__construct</a> — Construct a new MaxKey</li><li><a href="mongodb-bson-maxkey.jsonserialize.html">MongoDB\BSON\MaxKey::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-maxkey.serialize.html">MongoDB\BSON\MaxKey::serialize</a> — Serialize a MaxKey</li><li><a href="mongodb-bson-maxkey.unserialize.html">MongoDB\BSON\MaxKey::unserialize</a> — Unserialize a MaxKey</li></ul></li><li><a href="class.mongodb-bson-minkey.html">MongoDB\BSON\MinKey</a> — The MongoDB\BSON\MinKey class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-minkey.construct.html">MongoDB\BSON\MinKey::__construct</a> — Construct a new MinKey</li><li><a href="mongodb-bson-minkey.jsonserialize.html">MongoDB\BSON\MinKey::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-minkey.serialize.html">MongoDB\BSON\MinKey::serialize</a> — Serialize a MinKey</li><li><a href="mongodb-bson-minkey.unserialize.html">MongoDB\BSON\MinKey::unserialize</a> — Unserialize a MinKey</li></ul></li><li><a href="class.mongodb-bson-objectid.html">MongoDB\BSON\ObjectId</a> — The MongoDB\BSON\ObjectId class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-objectid.construct.html">MongoDB\BSON\ObjectId::__construct</a> — Construct a new ObjectId</li><li><a href="mongodb-bson-objectid.gettimestamp.html">MongoDB\BSON\ObjectId::getTimestamp</a> — Returns the timestamp component of this ObjectId</li><li><a href="mongodb-bson-objectid.jsonserialize.html">MongoDB\BSON\ObjectId::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-objectid.serialize.html">MongoDB\BSON\ObjectId::serialize</a> — Serialize an ObjectId</li><li><a href="mongodb-bson-objectid.tostring.html">MongoDB\BSON\ObjectId::__toString</a> — Returns the hexidecimal representation of this ObjectId</li><li><a href="mongodb-bson-objectid.unserialize.html">MongoDB\BSON\ObjectId::unserialize</a> — Unserialize an ObjectId</li></ul></li><li><a href="class.mongodb-bson-regex.html">MongoDB\BSON\Regex</a> — The MongoDB\BSON\Regex class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-regex.construct.html">MongoDB\BSON\Regex::__construct</a> — Construct a new Regex</li><li><a href="mongodb-bson-regex.getflags.html">MongoDB\BSON\Regex::getFlags</a> — Returns the Regex's flags</li><li><a href="mongodb-bson-regex.getpattern.html">MongoDB\BSON\Regex::getPattern</a> — Returns the Regex's pattern</li><li><a href="mongodb-bson-regex.jsonserialize.html">MongoDB\BSON\Regex::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-regex.serialize.html">MongoDB\BSON\Regex::serialize</a> — Serialize a Regex</li><li><a href="mongodb-bson-regex.tostring.html">MongoDB\BSON\Regex::__toString</a> — Returns the string representation of this Regex</li><li><a href="mongodb-bson-regex.unserialize.html">MongoDB\BSON\Regex::unserialize</a> — Unserialize a Regex</li></ul></li><li><a href="class.mongodb-bson-timestamp.html">MongoDB\BSON\Timestamp</a> — The MongoDB\BSON\Timestamp class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-timestamp.construct.html">MongoDB\BSON\Timestamp::__construct</a> — Construct a new Timestamp</li><li><a href="mongodb-bson-timestamp.getincrement.html">MongoDB\BSON\Timestamp::getIncrement</a> — Returns the increment component of this Timestamp</li><li><a href="mongodb-bson-timestamp.gettimestamp.html">MongoDB\BSON\Timestamp::getTimestamp</a> — Returns the timestamp component of this Timestamp</li><li><a href="mongodb-bson-timestamp.jsonserialize.html">MongoDB\BSON\Timestamp::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-timestamp.serialize.html">MongoDB\BSON\Timestamp::serialize</a> — Serialize a Timestamp</li><li><a href="mongodb-bson-timestamp.tostring.html">MongoDB\BSON\Timestamp::__toString</a> — Returns the string representation of this Timestamp</li><li><a href="mongodb-bson-timestamp.unserialize.html">MongoDB\BSON\Timestamp::unserialize</a> — Unserialize a Timestamp</li></ul></li><li><a href="class.mongodb-bson-utcdatetime.html">MongoDB\BSON\UTCDateTime</a> — The MongoDB\BSON\UTCDateTime class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-utcdatetime.construct.html">MongoDB\BSON\UTCDateTime::__construct</a> — Construct a new UTCDateTime</li><li><a href="mongodb-bson-utcdatetime.jsonserialize.html">MongoDB\BSON\UTCDateTime::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-utcdatetime.serialize.html">MongoDB\BSON\UTCDateTime::serialize</a> — Serialize a UTCDateTime</li><li><a href="mongodb-bson-utcdatetime.todatetime.html">MongoDB\BSON\UTCDateTime::toDateTime</a> — Returns the DateTime representation of this UTCDateTime</li><li><a href="mongodb-bson-utcdatetime.tostring.html">MongoDB\BSON\UTCDateTime::__toString</a> — Returns the string representation of this UTCDateTime</li><li><a href="mongodb-bson-utcdatetime.unserialize.html">MongoDB\BSON\UTCDateTime::unserialize</a> — Unserialize a UTCDateTime</li></ul></li><li><a href="class.mongodb-bson-type.html">MongoDB\BSON\Type</a> — The MongoDB\BSON\Type interface</li><li><a href="class.mongodb-bson-persistable.html">MongoDB\BSON\Persistable</a> — The MongoDB\BSON\Persistable interface</li><li><a href="class.mongodb-bson-serializable.html">MongoDB\BSON\Serializable</a> — The MongoDB\BSON\Serializable interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-serializable.bsonserialize.html">MongoDB\BSON\Serializable::bsonSerialize</a> — Provides an array or document to serialize as BSON</li></ul></li><li><a href="class.mongodb-bson-unserializable.html">MongoDB\BSON\Unserializable</a> — The MongoDB\BSON\Unserializable interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-unserializable.bsonunserialize.html">MongoDB\BSON\Unserializable::bsonUnserialize</a> — Constructs the object from a BSON array or document</li></ul></li><li><a href="class.mongodb-bson-binaryinterface.html">MongoDB\BSON\BinaryInterface</a> — The MongoDB\BSON\BinaryInterface interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-binaryinterface.getdata.html">MongoDB\BSON\BinaryInterface::getData</a> — Returns the BinaryInterface's data</li><li><a href="mongodb-bson-binaryinterface.gettype.html">MongoDB\BSON\BinaryInterface::getType</a> — Returns the BinaryInterface's type</li><li><a href="mongodb-bson-binaryinterface.tostring.html">MongoDB\BSON\BinaryInterface::__toString</a> — Returns the BinaryInterface's data</li></ul></li><li><a href="class.mongodb-bson-decimal128interface.html">MongoDB\BSON\Decimal128Interface</a> — The MongoDB\BSON\Decimal128Interface interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-decimal128interface.tostring.html">MongoDB\BSON\Decimal128Interface::__toString</a> — Returns the string representation of this Decimal128Interface</li></ul></li><li><a href="class.mongodb-bson-javascriptinterface.html">MongoDB\BSON\JavascriptInterface</a> — The MongoDB\BSON\JavascriptInterface interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-javascriptinterface.getcode.html">MongoDB\BSON\JavascriptInterface::getCode</a> — Returns the JavascriptInterface's code</li><li><a href="mongodb-bson-javascriptinterface.getscope.html">MongoDB\BSON\JavascriptInterface::getScope</a> — Returns the JavascriptInterface's scope document</li><li><a href="mongodb-bson-javascriptinterface.tostring.html">MongoDB\BSON\JavascriptInterface::__toString</a> — Returns the JavascriptInterface's code</li></ul></li><li><a href="class.mongodb-bson-maxkeyinterface.html">MongoDB\BSON\MaxKeyInterface</a> — The MongoDB\BSON\MaxKeyInterface interface</li><li><a href="class.mongodb-bson-minkeyinterface.html">MongoDB\BSON\MinKeyInterface</a> — The MongoDB\BSON\MinKeyInterface interface</li><li><a href="class.mongodb-bson-objectidinterface.html">MongoDB\BSON\ObjectIdInterface</a> — The MongoDB\BSON\ObjectIdInterface interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-objectidinterface.gettimestamp.html">MongoDB\BSON\ObjectIdInterface::getTimestamp</a> — Returns the timestamp component of this ObjectIdInterface</li><li><a href="mongodb-bson-objectidinterface.tostring.html">MongoDB\BSON\ObjectIdInterface::__toString</a> — Returns the hexidecimal representation of this ObjectIdInterface</li></ul></li><li><a href="class.mongodb-bson-regexinterface.html">MongoDB\BSON\RegexInterface</a> — The MongoDB\BSON\RegexInterface interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-regexinterface.getflags.html">MongoDB\BSON\RegexInterface::getFlags</a> — Returns the RegexInterface's flags</li><li><a href="mongodb-bson-regexinterface.getpattern.html">MongoDB\BSON\RegexInterface::getPattern</a> — Returns the RegexInterface's pattern</li><li><a href="mongodb-bson-regexinterface.tostring.html">MongoDB\BSON\RegexInterface::__toString</a> — Returns the string representation of this RegexInterface</li></ul></li><li><a href="class.mongodb-bson-timestampinterface.html">MongoDB\BSON\TimestampInterface</a> — The MongoDB\BSON\TimestampInterface interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-timestampinterface.getincrement.html">MongoDB\BSON\TimestampInterface::getIncrement</a> — Returns the increment component of this TimestampInterface</li><li><a href="mongodb-bson-timestampinterface.gettimestamp.html">MongoDB\BSON\TimestampInterface::getTimestamp</a> — Returns the timestamp component of this TimestampInterface</li><li><a href="mongodb-bson-timestampinterface.tostring.html">MongoDB\BSON\TimestampInterface::__toString</a> — Returns the string representation of this TimestampInterface</li></ul></li><li><a href="class.mongodb-bson-utcdatetimeinterface.html">MongoDB\BSON\UTCDateTimeInterface</a> — The MongoDB\BSON\UTCDateTimeInterface interface<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-utcdatetimeinterface.todatetime.html">MongoDB\BSON\UTCDateTimeInterface::toDateTime</a> — Returns the DateTime representation of this UTCDateTimeInterface</li><li><a href="mongodb-bson-utcdatetimeinterface.tostring.html">MongoDB\BSON\UTCDateTimeInterface::__toString</a> — Returns the string representation of this UTCDateTimeInterface</li></ul></li><li><a href="class.mongodb-bson-dbpointer.html">MongoDB\BSON\DBPointer</a> — The MongoDB\BSON\DBPointer class (deprecated)<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-dbpointer.construct.html">MongoDB\BSON\DBPointer::__construct</a> — Construct a new DBPointer (unused)</li><li><a href="mongodb-bson-dbpointer.jsonserialize.html">MongoDB\BSON\DBPointer::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-dbpointer.serialize.html">MongoDB\BSON\DBPointer::serialize</a> — Serialize a DBPointer</li><li><a href="mongodb-bson-dbpointer.tostring.html">MongoDB\BSON\DBPointer::__toString</a> — Returns an empty string</li><li><a href="mongodb-bson-dbpointer.unserialize.html">MongoDB\BSON\DBPointer::unserialize</a> — Unserialize a DBPointer</li></ul></li><li><a href="class.mongodb-bson-int64.html">MongoDB\BSON\Int64</a> — The MongoDB\BSON\Int64 class<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-int64.construct.html">MongoDB\BSON\Int64::__construct</a> — Construct a new Int64 (unused)</li><li><a href="mongodb-bson-int64.jsonserialize.html">MongoDB\BSON\Int64::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-int64.serialize.html">MongoDB\BSON\Int64::serialize</a> — Serialize an Int64</li><li><a href="mongodb-bson-int64.tostring.html">MongoDB\BSON\Int64::__toString</a> — Returns the string representation of this Int64</li><li><a href="mongodb-bson-int64.unserialize.html">MongoDB\BSON\Int64::unserialize</a> — Unserialize an Int64</li></ul></li><li><a href="class.mongodb-bson-symbol.html">MongoDB\BSON\Symbol</a> — The MongoDB\BSON\Symbol class (deprecated)<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-symbol.construct.html">MongoDB\BSON\Symbol::__construct</a> — Construct a new Symbol (unused)</li><li><a href="mongodb-bson-symbol.jsonserialize.html">MongoDB\BSON\Symbol::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-symbol.serialize.html">MongoDB\BSON\Symbol::serialize</a> — Serialize a Symbol</li><li><a href="mongodb-bson-symbol.tostring.html">MongoDB\BSON\Symbol::__toString</a> — Returns the Symbol as a string</li><li><a href="mongodb-bson-symbol.unserialize.html">MongoDB\BSON\Symbol::unserialize</a> — Unserialize a Symbol</li></ul></li><li><a href="class.mongodb-bson-undefined.html">MongoDB\BSON\Undefined</a> — The MongoDB\BSON\Undefined class (deprecated)<ul class="chunklist chunklist_book chunklist_children"><li><a href="mongodb-bson-undefined.construct.html">MongoDB\BSON\Undefined::__construct</a> — Construct a new Undefined (unused)</li><li><a href="mongodb-bson-undefined.jsonserialize.html">MongoDB\BSON\Undefined::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-undefined.serialize.html">MongoDB\BSON\Undefined::serialize</a> — Serialize a Undefined</li><li><a href="mongodb-bson-undefined.tostring.html">MongoDB\BSON\Undefined::__toString</a> — Returns an empty string</li><li><a href="mongodb-bson-undefined.unserialize.html">MongoDB\BSON\Undefined::unserialize</a> — Unserialize a Undefined</li></ul></li></ul></div></div></div></body></html>